package com.iotteam.androidbase.commen.network.core;

import com.iotteam.androidbase.commen.network.onhttp.NohttpWrapper;

import java.util.Map;

/**
 * Created by lidechen on 5/5/17.
 */

public class HttpManager implements INetworkWrapper {

    private static INetworkWrapper sWrapper = new HttpManager();

    private HttpManager(){};

    public static INetworkWrapper getInstance(){
        return sWrapper;
    }

    @Override
    public void init() {
        sWrapper = NohttpWrapper.getInstance();
        sWrapper.init();
    }

    @Override
    public <T> void postBean(String url, Map<String, String> params, Class<T> clazz, HttpListener<T> listener) {
        sWrapper.postBean(url, params, clazz, listener);
    }

    @Override
    public void postString(String url, Map<String, String> params, HttpListener<String> listener) {
        sWrapper.postString(url, params, listener);
    }

    @Override
    public <T> void getBean(String url, Map<String, String> params, Class<T> clazz, HttpListener<T> listener) {
        sWrapper.getBean(url, params, clazz, listener);
    }

    @Override
    public void cancelPostBean(Map params) {
        sWrapper.cancelPostBean(params);
    }
}
